<?php
/**
 * PostUrl.php
 *
 * @category    Madoqua
 * @package     Module
 * @subpackage  Blog
 */

/** base class */
require_once 'Madoqua/View/Helper/Abstract.php';

/**
 * Madoqua_View_Helper_PostUrl
 * 
 * generates a url to a post
 * 
 * @category    Madoqua
 * @package     Module
 * @subpackage  Blog
 */
class Madoqua_View_Helper_PostUrl extends Madoqua_View_Helper_Abstract 
{
    /**
     * get url for a post
     *
     * @param Blog_Post_Row $post
     */
    public function postUrl($post)
    {
        if (is_string($post)) {
            //string is given, assume slug
            return $this->_view->url(array('slug' => $post), 'post_read', true);    
        }
        return $this->_view->url(array('slug' => $post->slug), 'post_read', true);
    }
}